package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class InformationActivity extends AppCompatActivity {
    ImageView image;
Button sendmessage;
TextView name;
TextView id;
TextView Region;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.information_activity);
        Sinformation sp3 =(Sinformation)getIntent().getSerializableExtra("Sp");
        name=(TextView) findViewById(R.id.name);
        id=(TextView) findViewById(R.id.WeChat_ID);
        image=(ImageView) findViewById(R.id.image);
        if (sp3.getID().equals("1")) {
            image.setImageResource(R.drawable.he);
        }
        if (sp3.getID().equals("2")) {
            image.setImageResource(R.drawable.lv);
        }
        if (sp3.getID().equals("3")) {
            image.setImageResource(R.drawable.cai);
        }
        id.setText("ID: "+sp3.getID());
        Region=(TextView) findViewById(R.id.Region);
        Region.setText("Region: "+sp3.getRegion());
        name.setText("Name " +sp3.getName());
        sendmessage=(Button) findViewById(R.id.send_message);
        sendmessage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(InformationActivity.this,ChatActivity.class);
                intent.putExtra("Sp", sp3);
                startActivity(intent);
            }
        });

    }
}